package com.study.d6_exception;

public class DiyException {
    public static void main(String[] args) {
        try {
            isSuper(50);
            System.out.println("成功");
        } catch (Exception e) {
            System.out.println("失败");
            throw new RuntimeException(e);
        }
    }

    private static void isSuper(int i) {
        if(i<20||i>100)
            //通过throw new 异常类（xxx）来创建异常对象并抛出
            //编译阶段不报错，提醒不及时，运行时才可能出现
            throw new SuperAgeException("不合格！");
        else
            System.out.println("成功，i is ：" +i);
    }
}
